<html ng-app="manuskript.app">
  <head>
    <meta charset="UTF-8">
    <!-- manuskript-headers -->
  </head>
  <body ng-controller="ManuskriptAppController">
    <!-- Navigation bar -->
    <nav class="navbar navbar-default navbar-fixed-top"
         role="navigation"
         >
      <div class="container-fluid">
        <div class="col-md-{{margin_width}}">
          <span class="label label-info">
            {{worksheet_filename}}
          </span>
        </div>

        <div class="col-md-{{main_width}}">
          <!-- Toolbar -->
          <div class="btn-group btn-group-sm"
               ng-if="app_config.mode!='static'"
               >
            <div class="btn btn-default navbar-btn"
                 tooltip="Manage session." tooltip-placement="bottom"
                 tooltip-append-to-body
                 ng-click="manageSession()">
              <span class="glyphicon glyphicon-off"></span> Session
            </div>
            <button type="button" class="btn btn-default navbar-btn"
                    ng-click="addNode()">
              <span class="glyphicon glyphicon-plus"></span> Cell
            </button>
            <div class="btn-group btn-group-sm">
              <button type="button" class="btn btn-default navbar-btn dropdown-toggle" data-toggle="dropdown">
                <div class="caret"></div>&nbsp;
              </button>
              <ul class="dropdown-menu" role="menu">
                <li role="presentation" ng-class="selection.node == null && 'disabled'">
                  <a role="menuitem" ng-click="addNodeBefore(selection.node)"
                     href="#">Insert Before Current</a>
                </li>
                <li role="presentation" ng-class="selection.node == null && 'disabled'">
                  <a role="menuitem" ng-click="addNodeAfter(selection.node)"
                     href="#">Insert After Current</a>
                </li>
                <li role="presentation">
                  <a role="menuitem" ng-click="addNode(-1)" href="#">Append To The End</a>
                </li>
              </ul>
            </div>
          </div>

          <div class="btn-group"
               ng-if="app_config.mode!='static'"
               >
            <div class="btn btn-default upload"
               tooltip="Open an existing worksheet." tooltip-placement="bottom"
               tooltip-append-to-body
               ng-click="openWorksheet()">
              <span class="glyphicon glyphicon-folder-open"></span>
            </div>

            <div class="btn btn-default upload"
               tooltip="Save worksheet." tooltip-placement="bottom"
               tooltip-append-to-body
               ng-click="saveWorksheet()">
              <span class="glyphicon glyphicon-floppy-disk"></span>
            </div>

            <a target="_self" class="btn btn-default"
               tooltip="Download the worksheet." tooltip-placement="bottom"
               tooltip-append-to-body
               href="/downloads/worksheet">
              <span class="glyphicon glyphicon-cloud-download"></span>
            </a>

            <div class="btn btn-default upload"
               tooltip="Upload a new worksheet." tooltip-placement="bottom"
               tooltip-append-to-body
               ng-file-select="uploadWorksheet($files)">
              <span class="glyphicon glyphicon-cloud-upload"></span>
            </div>
          </div>

          <div class="btn-group right-padded"
               ng-if="app_config.mode!='static'"
               >
            <button type="button" class="btn btn-default"
                    ng-disabled="selection.node == null || selection.node.state == 'edit'"
                    ng-click="editNode(selection.node)">
              <span class="glyphicon glyphicon-edit"></span>
            </button>
            <button type="button"
                    ng-class="selection.node.state == 'edit' && 'btn btn-success' || 'btn btn-default'"
                    ng-disabled="selection.node.state != 'edit'"
                    ng-click="renderNode()">
              <span class="glyphicon glyphicon-ok"></span>
            </button>
          </div>

          <div class="btn-group right-padded"
               >
            <button type="button" class="btn btn-default"
                    ng-disabled="!canMoveNodeUp(selection.node)"
                    ng-if="app_config.mode!='static'"
                    ng-click="moveNodeUp(selection.node)">
              <span class="glyphicon glyphicon-arrow-up"></span>
            </button>
            <button type="button" class="btn btn-default"
                    ng-disabled="!canMoveNodeDown(selection.node)"
                    ng-if="app_config.mode!='static'"
                    ng-click="moveNodeDown(selection.node)">
              <span class="glyphicon glyphicon-arrow-down"></span>
            </button>
            <button type="button" class="btn btn-default"
                    ng-click="toggleMainWidth()">
              <span class="glyphicon glyphicon-resize-horizontal"></span>
            </button>
          </div>

          <div class="btn-group"
               ng-if="app_config.mode!='static'"
               >
            <button type="button" class="btn btn-default"
                    ng-disabled="0 && selection.node == null"
                    ng-click="loadNodesFromServer()">
              <span class="glyphicon glyphicon-repeat"></span>
            </button>
            <button type="button" class="btn btn-default" ng-disabled="selection.node == null"
                    ng-click="removeNode(selection.node)">
              <span class="glyphicon glyphicon-trash"></span>
            </button>
          </div>


        </div>
      </div>
    </nav>

    <!-- List of all the nodes. -->
    <div class="container-fluid" id="cells">
      <div class="col-md-{{margin_width}}"></div>
      <div class="col-md-{{main_width}}" id="main">
        <div ng-if="nodes.length == 0">
          <div class="page-header">
            <h1>Welcome to Rekall Memory Forensics
              <small>We can remember it for you wholesale!</small>
            </h1>
            <div class="alert alert-success" role="alert">Add a new Cell to get started</div>
            <div class="rekall-logo">
              <img src="%(root_url)srekall-webconsole/images/Rekall.png"
                   class="img-thumbnail" />
            </div>
          </div>
        </div>
        <div ng-repeat="node in nodes" ng-click="selection.node = node">
          <div ng-include="getIncludedFile(node)" ng-class="cellClass(node)">
          </div>

        </div>
      </div>
    </div>
  </body>
</html>
